package com.wondedDream.controller.admin;

import com.wondedDream.model.UserMockExamQuestionRecord;
import com.wondedDream.service.UserMockExamQuestionRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController(value = "adminUserMockExamQuestionRecordController")
@RequestMapping("/api/userMockExamQuestionRecords")
@Api(description = "管理端-用户模考问题信息")
public class UserMockExamQuestionRecordController {
    @Autowired
    private UserMockExamQuestionRecordService userMockExamQuestionRecordService;

    // 保存用户模考问题记录
    @PostMapping("/")
    @ApiOperation(value = "保存用户模考问题记录")
    public UserMockExamQuestionRecord saveUserMockExamQuestionRecord(@RequestBody UserMockExamQuestionRecord record) {
        return userMockExamQuestionRecordService.saveUserMockExamQuestionRecord(record);
    }

    // 根据记录 ID 获取用户模考问题记录
    @GetMapping("/{recordId}")
    @ApiOperation(value = "根据记录 ID 获取用户模考问题记录")
    public UserMockExamQuestionRecord getUserMockExamQuestionRecord(@PathVariable Integer recordId) {
        return userMockExamQuestionRecordService.getUserMockExamQuestionRecordById(recordId);
    }

    // 根据用户模考记录 ID 获取所有模考问题记录
    @GetMapping("/byUserMockExamRecord/{userMockExamRecordId}")
    @ApiOperation(value = "根据用户模考记录 ID 获取所有模考问题记录")
    public List<UserMockExamQuestionRecord> getUserMockExamQuestionRecordsByUserMockExamRecord(@PathVariable Integer userMockExamRecordId) {
        return userMockExamQuestionRecordService.getUserMockExamQuestionRecordsByUserMockExamRecord(userMockExamRecordId);
    }

    // 根据模考问题 ID 获取所有用户的模考问题记录
    @GetMapping("/byMockExamQuestion/{mockExamQuestionId}")
    @ApiOperation(value = "根据模考问题 ID 获取所有用户的模考问题记录")
    public List<UserMockExamQuestionRecord> getUserMockExamQuestionRecordsByMockExamQuestion(@PathVariable String mockExamQuestionId) {
        return userMockExamQuestionRecordService.getUserMockExamQuestionRecordsByMockExamQuestion(mockExamQuestionId);
    }

    // 获取所有用户的模考问题记录
    @GetMapping("/")
    @ApiOperation(value = "获取所有用户的模考问题记录")
    public List<UserMockExamQuestionRecord> getAllUserMockExamQuestionRecords() {
        return userMockExamQuestionRecordService.getAllUserMockExamQuestionRecords();
    }

    // 删除用户模考问题记录
    @DeleteMapping("/{recordId}")
    @ApiOperation(value = "删除用户模考问题记录")
    public void deleteUserMockExamQuestionRecord(@PathVariable Integer recordId) {
        userMockExamQuestionRecordService.deleteUserMockExamQuestionRecord(recordId);
    }
}

